package com.fxnotes.common;

import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.fxnotes.domain.model.NamedEntity;
import java.util.List;

public class Utils {

    public static <T extends NamedEntity> boolean containsEntityWithName(List<T> entities, final String name) {
        return !Collections2.filter(entities, new Predicate<T>() {

            @Override
            public boolean apply(T entity) {
                return entity.getName().equals(name);
            }
        }).isEmpty();
    }
}